package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.service.HomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/system/Home")
public class HomeController {
    @Autowired
    private HomeService homeService;

    //全部项目数量
    @GetMapping("/projectsAll")
    public Integer projectsAll()
    {
        return homeService.selectprojectsAll();
    }

    //已完成项目数量
    @GetMapping("/projectComplete")
    public Integer projectComplete()
    {
        return homeService.selectprojectComplete();
    }

    //未完成项目数量
    @GetMapping("/projectUnfinished")
    public Integer projectUnfinished()
    {
        return homeService.selectprojectUnfinished();
    }

    //每个仓库材料占比
    @GetMapping("/chart")
    public List<ChartVo> chart(){
        return homeService.chart();
    }

    //根据年份查询每个月的出入库
    @GetMapping("/barchart")
    public BarChartVo barchart(String recordtime){
        return homeService.BarChart(recordtime);
    }

    //根据年月查询康城仓库查询每个月的出入库
    @GetMapping("/balance")
    public Balance balance(String time){
        return homeService.selectBalance(time);
    }

    //查看材料请购那些没生成采购
    @GetMapping("/requisition")
    public CountReq countReq(){
        return homeService.countReq();
    }
    //查看器具请购那些没生成采购
    @GetMapping("/purchase")
    public CountPur countPur(){
        return homeService.countPur();
    }

    //返回所有付款单位
    @GetMapping("/payment")
    public List<PaymentUnit> payment(){
        return homeService.payment();
    }

    //备忘录查看
    @GetMapping("/remark")
    public String remark(){
       return homeService.remark();
    }
    //备忘录修改
    @PostMapping("/addremark")
    public AjaxResult remark(@RequestBody String remark){
        System.out.println(remark);
        return AjaxResult.success(homeService.addremark(remark));
    }

}
